
import { request } from '../../utils/request';
Page({
  data:{title:'',category:'',price:0,description:''},
  onTitle(e){this.setData({title:e.detail.value});},
  onCategory(e){this.setData({category:e.detail.value});},
  onPrice(e){this.setData({price:+e.detail.value});},
  onDesc(e){this.setData({description:e.detail.value});},
  async submit(){
    const body = {userId:1,title:this.data.title,category:this.data.category,price:this.data.price,description:this.data.description};
    const res = await request('/api/items','POST', body);
    wx.showToast({title:'发布成功'});
  }
});
